﻿<%@ Page Title="Register" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="Register.aspx.vb" Inherits="webfinancegdrassign4.Register" %>

<%--Smart Money Saver -  Project for University of Herts--%>
<%--Date: 08 Jan 2014--%>
<%--Version 1--%>
<%--Project Brief Description - This is a Smart Money Saver asp.net product using VB.net. It is intended to be used by Smart Money Savers  who want to make and save money and earn a certain amount for themselves--%>
<%--Program Brief Description - This is the about site program file. It gives you basic text information about what this site is about. --%>

<%--Update 1 -  08 Jan 2014 - Register.aspx , Update - add a check to see income greater than 100k, Add in User, password, email and type to sms_register--%>
<%--Update-2 -  12 Jan 2014 - Register.aspx , Update - added a Javascript to check email format, added a cookie to the system for username, general tidy up  Also a redirection to login.aspx--%>
<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
    <div class="hero-unit" style="padding:20px">


        <hgroup class="title" style="margin-left: 25%">
            <h1>
                <br />
            </h1>
            <h2><%: Title %></h2>

            <script type="text/javascript">

                function checkEmail() {

                    var email = document.getElementById('theemailaddress'.value);
                    var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;

                    if (!filter.test(email)) {
                        alert('Please provide a valid email address');
                        return false;
                    }
                }</script>



        </hgroup>
        <p class="text-error">
            <asp:Literal runat="server" ID="ErrorMessage" />
        </p>

        <fieldset class="form-horizontal" style="margin-left: 25%">

            <legend>Create a new account.</legend>


            <div class="control-group">
                <asp:Label runat="server" CssClass="control-label" Style="padding-right: 13px; width: 167px; font-size: 14px;padding-top:0px">Enter Income</asp:Label>
                <asp:TextBox runat="server" ID="chkincome" CssClass="textbox"></asp:TextBox>
                <asp:RangeValidator ID="RangeValidator1" runat="server" ErrorMessage="Your Salary is less than 100K" MinimumValue="100000" ControlToValidate="chkincome" Display="Dynamic" MaximumValue="1000000" SetFocusOnError="True" Type="Integer" ValidationGroup="r"></asp:RangeValidator>
                <br />
            </div>


            <div class="control-group">
                <asp:Label runat="server" CssClass="control-label" Style="padding-right: 13px; width: 167px; font-size: 14px;padding-top:0px">Email Address</asp:Label>
                <asp:TextBox runat="server" ID="theemailaddress" CssClass="textbox"></asp:TextBox>
                <input type='submit' name='submit' style="width: 141px;" value="Check Email format" class="button" onclick='Javascript: checkEmail();' />


            </div>
            <div class="control-group">
                <asp:Label runat="server" AssociatedControlID="UserName" CssClass="control-label" Style="padding-right: 13px; width: 167px;padding-top:0px">User name</asp:Label>
                <div class="controls">
                    <asp:TextBox runat="server" ID="UserName" CssClass="textbox"></asp:TextBox>
                </div>
            </div>
            <div class="control-group">
                <asp:Label runat="server" AssociatedControlID="Password" CssClass="control-label" Style="padding-right: 13px; width: 167px;padding-top:0px">Password</asp:Label>
                <div class="controls">
                    <asp:TextBox runat="server" ID="Password" TextMode="Password" CssClass="textbox" />
                    <asp:RequiredFieldValidator runat="server" ControlToValidate="Password"
                        CssClass="text-error" ErrorMessage="The password field is required." ValidationGroup="r"/>
                </div>
            </div>
            <div class="control-group">
                <asp:Label runat="server" AssociatedControlID="ConfirmPassword" CssClass="control-label" Style="padding-right: 13px; width: 167px;padding-top:0px">Confirm password</asp:Label>
                <div class="controls">
                    <asp:TextBox runat="server" ID="ConfirmPassword" TextMode="Password" CssClass="textbox" />
                    <asp:RequiredFieldValidator runat="server" ControlToValidate="ConfirmPassword"
                        CssClass="text-error" Display="Dynamic" ErrorMessage="The confirm password field is required." ValidationGroup="r"/>
                    <asp:CompareValidator runat="server" ControlToCompare="Password" ControlToValidate="ConfirmPassword"
                        CssClass="text-error" Display="Dynamic" ErrorMessage="The password and confirmation password do not match." ValidationGroup="r" />
                </div>
            </div>

            <asp:Button runat="server" OnClick="CreateUser" Text="Register" CssClass="button" ValidationGroup="r" Style="margin-left: 180px;" />
            <asp:TextBox ID="theusername" runat="server" Visible="False"></asp:TextBox>
            <asp:TextBox ID="thereference" runat="server" Visible="False"></asp:TextBox>

        </fieldset>

    </div>
</asp:Content>

